cmake_minimum_required(VERSION 3.16)
project(gnss_imu_lidar_align)
set(REALSE_MODE 1)
if(REALSE_MODE)
    message("Realse Mode")
    SET(CMAKE_BUILD_TYPE "Rlease")
    SET( CMAKE_CXX_FLAGS "-std=c++17 -O3" )
else() 
    message("Debug Mode")
    SET(CMAKE_BUILD_TYPE "Debug")
    set( CMAKE_CXX_FLAGS "-std=c++17" )
endif()
add_compile_options(-std=c++17)
## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
add_definitions(-DWORK_PROJ_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
find_package(catkin REQUIRED COMPONENTS
  message_generation
  message_runtime
  nav_msgs
  roscpp
  rospy
  sensor_msgs
  std_msgs
  eigen_conversions
  self_localization_transform
  cloud_pose_msg

)
find_package (GeographicLib REQUIRED)
find_package(Ceres REQUIRED)
find_package(PCL REQUIRED)
find_package(yaml-cpp REQUIRED)
catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES gnss_imu_aligen
#  CATKIN_DEPENDS message_generation message_runtime nav_msgs roscpp rospy sensor_msgs std_msgs
#  DEPENDS system_lib
)


include_directories(
  include
  lib
  ${catkin_INCLUDE_DIRS}
  ${GeographicLib_INCLUDE_DIRS}
  ${PCL_INCLUDE_DIRS}
  ${YAML_CPP_INCLUDE_DIRS}
)
add_library(SC_ESKF 
    lib/SC_ESKF/src/eskf.cpp
    lib/SC_ESKF/src/SO3.cpp
    )
target_include_directories(SC_ESKF PRIVATE
    lib/SC_ESKF/include
    )

set(GNSS_IMU_ALIGEN_SRC_FILES
    src/gnss_imu_align/gnss_imu_align_wrapper.cpp
    src/gnss_imu_align/gnss_imu_align.cpp
    src/align_imu_node.cpp
)
add_executable(gnss_imu_align_node ${GNSS_IMU_ALIGEN_SRC_FILES})
target_link_libraries(gnss_imu_align_node
  SC_ESKF
  ${catkin_LIBRARIES}
  ${GeographicLib_LIBRARIES}
  ${YAML_CPP_LIBRARIES}
)

set(ALIGEN_ENU_SRC_FILES
    src/align_enu/align_enu_wrapper.cpp
    src/align_enu_node.cpp
    src/align_enu/align_enu.cpp

)
add_executable(align_enu_node ${ALIGEN_ENU_SRC_FILES})
target_link_libraries(align_enu_node
Ceres::ceres
  ${catkin_LIBRARIES}
  ${PCL_LIBRARIES}
#   ${GeographicLib_LIBRARIES}
)
add_executable(test_node src/test.cpp)
target_link_libraries(test_node
  ${catkin_LIBRARIES}
  ${PCL_LIBRARIES}
#   ${GeographicLib_LIBRARIES}
)
